﻿import com.dmotiko.mirador.*
import com.dmotiko.general.*
import com.dmotiko.util.DataTypeUtil
import mx.utils.Delegate;
import mx.video.*;

class MiradorServicioGaleria
extends BaseClip {
		
	private var mcDanbro:MiradorInternalBtn;
	private var mcMirador:MiradorInternalBtn;
	private var mcAltos:MiradorInternalBtn;
		
	private var mcPhotoClip:PhotoClip;
	private var mcPhotoThumbs:MiradorPhotoGalleryThumbs;
	private var lastBtn:MiradorInternalBtn;
			
	private function room_selected( e ):Void {
				
		if ( lastBtn ) lastBtn.setActive(false, true);
		lastBtn = e.target;
		switch( lastBtn ) {
			case mcDanbro:
			mcPhotoThumbs.setData( data.danbro );
			MiradorSite.getApp().setContext( MiradorSite.DANBRO );
			break;
			
			case mcMirador:
			mcPhotoThumbs.setData( data.mirador );
			MiradorSite.getApp().setContext( MiradorSite.MIRADOR );
			break;
			
			case mcAltos:
			mcPhotoThumbs.setData( data.altos );
			MiradorSite.getApp().setContext( MiradorSite.MIRADOR );
			break;
		}
	}
	
	public function childLoaded( evnt ):Void {
		if ( MiradorInternalBtn( evnt.target ) ) {
			evnt.target.addEventListener( BaseClipEvent.CHANGED, Delegate.create(this, room_selected) );
		}
		if( MiradorPhotoGalleryThumbs( evnt.target) ){
			mcPhotoThumbs.addEventListener( BaseClipEvent.CHANGED, Delegate.create(this, setPhoto) );
			mcDanbro.onRollOver();
			mcDanbro.onRelease();
		} 
	}
	
	private function setPhoto(e):Void {
		mcPhotoClip.setData(e.data.src);
	}
	
	private function refreshData():Void {
		
	}
	
}